import matplotlib as mpl
import matplotlib.pyplot as plt

fileName = "results.txt"

f = open(fileName)
nBodies = []
times = []

line = f.readline()
while line != '':
   line1 = line # Number of bodies
   line2 = f.readline() # Start time
   line3 = f.readline() # Stop time
   line4 = f.readline() # Blank space

   startDate = line2.split()
   start = float(startDate[0]) + float(startDate[1])*1.0e-9

   endDate = line3.split()
   end = float(endDate[0]) + float(endDate[1])*1.0e-9

   nBodies.append(int(line1))
   times.append(end-start)

   line = f.readline()

print nBodies
print times

fig = plt.figure()

ax = fig.add_subplot(111)
ax.loglog(nBodies, times, 'ro')
ax.set_ylim(1.0e-1, 1.0e3)
ax.set_xlim(1.0e1, 1.0e5)

plt.savefig("timing.png")
